/*
 * @Copyright: 2017 www.yyfax.com Inc. All rights reserved.
 */
package com.yyfax.pay.order.data.service;

import java.util.List;

import com.yyfax.pay.order.model.po.UserPaymentPO;

/**
 * 用户支付信息服务接口
 *
 * @author buyi
 * @date 2017-04-12 11:09:15
 * @since 1.0.0
 */
public interface UserPaymentService {
	/**
	 * 根据主键查询实体
	 *
	 * @author buyi
	 * @date 2017年4月3日上午1:28:16
	 * @since 1.0.0
	 * @param id
	 *        主鍵
	 * @param merchantCode
	 *        商户编号(分表预留参数)
	 * @return
	 * @throws Exception
	 */
	public UserPaymentPO queryByIdAndMerchantCode(int id, String merchantCode) throws Exception;

	/**
	 * 获取用户支付认证信息
	 * 
	 * @author buyi
	 * @date 2017-04-17 14:36:30
	 * @since v1.0.0
	 * @param merchantCode
	 * @param userId
	 * @param paymentCode
	 * @return
	 * @throws Exception
	 */
	public UserPaymentPO query(String merchantCode, String userId, String paymentCode);

	/**
	 * 保存实体对象
	 *
	 * @author buyi
	 * @date 2017年4月3日上午1:28:22
	 * @since 1.0.0
	 * @param po
	 *        实体对象
	 * @return 返回主鍵，如果返回-1,0表示失败
	 * @throws Exception
	 */
	public int save(UserPaymentPO po) throws Exception;

	/**
	 * 根据商户号获取用户支付认证信息
	 * 
	 * @author buyi
	 * @date 2017-04-12 17:25:27
	 * @since v1.0.0
	 * @param merchantCode
	 * @return
	 * @throws Exception
	 */
	public List<UserPaymentPO> queryListByUserIdAndMerchantCode(String userId, String merchantCode) throws Exception;

	/**
	 * 更新用户支付认证信息
	 * 
	 * @author buyi
	 * @date 2017-04-17 15:19:26
	 * @since v1.0.0
	 * @param userPaymentPO
	 * @throws Exception
	 */
	public void modify(UserPaymentPO userPaymentPO) throws Exception;

	/**
	 * 逻辑删除用户的支付认证信息
	 * 
	 * @author buyi
	 * @date 2017-04-18 20:02:29
	 * @since v1.0.0
	 * @param merchantCode
	 * @param userId
	 * @param paymentCode
	 * @param cardNo
	 * @return 如果刪除成功返回1
	 * @throws Throwable
	 */
	public int remove(String merchantCode, String userId, String paymentCode, String cardNo) throws Throwable;

	/**
	 * 更新用户支付鉴权信息的手机号码
	 * 
	 * @author buyi
	 * @since v1.2.0
	 * @param userAuthId
	 * @param phone
	 */
	public int modifyPhone(int id, String phone);

	/**
	 * 更换手机号
	 * 
	 * @author buyi
	 * @date 2017-09-15 10:07:48
	 * @since v2.0.0
	 * @param merchantCode
	 * @param userId
	 * @param paymentCode
	 * @param new_mobile
	 * @return
	 */
	public int modifyPhone(String merchantCode, String userId, String paymentCode, String newPhone);


	int saveOrUpdate(UserPaymentPO userPaymentPO);
}
